home *** CD-ROM | disk | FTP | other *** search
- import java.awt.Button;
- import java.awt.Container;
- import java.awt.FlowLayout;
- import java.awt.Panel;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import java.awt.event.KeyEvent;
- import java.io.IOException;
- import java.util.EventObject;
-
- class ButtonPanel extends Panel implements ActionListener {
- VncViewer viewer;
- Button disconnectButton;
- Button optionsButton;
- Button recordButton;
- Button clipboardButton;
- Button ctrlAltDelButton;
- Button refreshButton;
-
- ButtonPanel(VncViewer var1) {
- this.viewer = var1;
- ((Container)this).setLayout(new FlowLayout(0, 0, 0));
- this.disconnectButton = new Button("Disconnect");
- this.disconnectButton.setEnabled(false);
- ((Container)this).add(this.disconnectButton);
- this.disconnectButton.addActionListener(this);
- this.optionsButton = new Button("Options");
- ((Container)this).add(this.optionsButton);
- this.optionsButton.addActionListener(this);
- this.clipboardButton = new Button("Clipboard");
- this.clipboardButton.setEnabled(false);
- ((Container)this).add(this.clipboardButton);
- this.clipboardButton.addActionListener(this);
- if (this.viewer.rec != null) {
- this.recordButton = new Button("Record");
- ((Container)this).add(this.recordButton);
- this.recordButton.addActionListener(this);
- }
-
- this.ctrlAltDelButton = new Button("Send Ctrl-Alt-Del");
- this.ctrlAltDelButton.setEnabled(false);
- ((Container)this).add(this.ctrlAltDelButton);
- this.ctrlAltDelButton.addActionListener(this);
- this.refreshButton = new Button("Refresh");
- this.refreshButton.setEnabled(false);
- ((Container)this).add(this.refreshButton);
- this.refreshButton.addActionListener(this);
- }
-
- public void actionPerformed(ActionEvent var1) {
- this.viewer.moveFocusToDesktop();
- if (((EventObject)var1).getSource() == this.disconnectButton) {
- this.viewer.disconnect();
- } else if (((EventObject)var1).getSource() == this.optionsButton) {
- this.viewer.options.setVisible(this.viewer.options.isVisible() ^ true);
- } else if (((EventObject)var1).getSource() == this.recordButton) {
- this.viewer.rec.setVisible(this.viewer.rec.isVisible() ^ true);
- } else if (((EventObject)var1).getSource() == this.clipboardButton) {
- this.viewer.clipboard.setVisible(this.viewer.clipboard.isVisible() ^ true);
- } else if (((EventObject)var1).getSource() == this.ctrlAltDelButton) {
- try {
- boolean var2 = true;
- KeyEvent var3 = new KeyEvent(this, 401, 0L, 10, 127);
- this.viewer.rfb.writeKeyEvent(var3);
- var3 = new KeyEvent(this, 402, 0L, 10, 127);
- this.viewer.rfb.writeKeyEvent(var3);
- } catch (IOException var5) {
- ((Throwable)var5).printStackTrace();
- }
- } else if (((EventObject)var1).getSource() == this.refreshButton) {
- try {
- RfbProto var6 = this.viewer.rfb;
- var6.writeFramebufferUpdateRequest(0, 0, var6.framebufferWidth, var6.framebufferHeight, false);
- } catch (IOException var4) {
- ((Throwable)var4).printStackTrace();
- }
- }
-
- }
-
- public void disableButtonsOnDisconnect() {
- ((Container)this).remove(this.disconnectButton);
- this.disconnectButton = new Button("Hide desktop");
- this.disconnectButton.setEnabled(true);
- ((Container)this).add(this.disconnectButton, 0);
- this.disconnectButton.addActionListener(this);
- this.optionsButton.setEnabled(false);
- this.clipboardButton.setEnabled(false);
- this.ctrlAltDelButton.setEnabled(false);
- this.refreshButton.setEnabled(false);
- ((Container)this).validate();
- }
-
- public void enableButtons() {
- this.disconnectButton.setEnabled(true);
- this.clipboardButton.setEnabled(true);
- this.refreshButton.setEnabled(true);
- }
-
- public void enableRemoteAccessControls(boolean var1) {
- this.ctrlAltDelButton.setEnabled(var1);
- }
- }
-